package com.iraeta.controller.system;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.iraeta.common.Result;
import com.iraeta.controller.BaseController;
import com.iraeta.entity.Loginlog;
import com.iraeta.service.sys.LoginLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController(value = "LoginLogController")
@RequestMapping("sys/loginlog")
public class LoginLogController extends BaseController {
    private static final Logger logger = LoggerFactory.getLogger(LoginLogController.class);
    @Autowired
    LoginLogService loginLogService;

    @RequestMapping("pagelog")
    public String pageLog(@RequestBody JSONObject jo){
        String startDate = jo.getString("startDate");
        String endDate = jo.getString("endDate");
        this.pageSet(jo);
        List<Loginlog> loginlogList = loginLogService.listLoginLog(startDate, endDate);
        PageInfo<Loginlog> loginlogPageInfo = this.getPageInfo(loginlogList);
        return this.success(loginlogPageInfo);
    }
}
